/*
 * Copyright (C) 2023-2023 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * Description: supply errors definition for interfaces.
 * Author: zhangjingnan
 * Create: 2023-4-11
 */

#ifndef CAST_ENGINE_ERRORS_H
#define CAST_ENGINE_ERRORS_H

#include <cinttypes>
#include "errors.h"
#include "cast_engine_common.h"

namespace OHOS {
namespace CastEngine {
constexpr int32_t EXPORT CAST_ENGINE_ERROR = -1;
constexpr int32_t EXPORT CAST_ENGINE_SUCCESS = 0;
constexpr int32_t EXPORT CAST_ENGINE_ERROR_BASE = 1000;
constexpr int32_t EXPORT ERR_NO_MEMORY = -(CAST_ENGINE_ERROR_BASE + 1);
constexpr int32_t EXPORT ERR_INVALID_PARAM = -(CAST_ENGINE_ERROR_BASE + 2);
constexpr int32_t EXPORT ERR_NO_PERMISSION = -(CAST_ENGINE_ERROR_BASE + 3);
constexpr int32_t EXPORT ERR_SESSION_NOT_EXIST = -(CAST_ENGINE_ERROR_BASE + 4);
constexpr int32_t EXPORT ERR_SERVICE_STATE_NOT_MATCH = -(CAST_ENGINE_ERROR_BASE + 5);
constexpr int32_t EXPORT ERR_SESSION_STATE_NOT_MATCH = -(CAST_ENGINE_ERROR_BASE + 6);
constexpr int32_t EXPORT ERR_SERVICE_IS_UNLOADING = -(CAST_ENGINE_ERROR_BASE + 7);

constexpr int32_t EXPORT ERROR_CODE_OK = 0;

// Generic error
constexpr int32_t EXPORT ERROR_CODE_UNSPECIFIED = 1000;
constexpr int32_t EXPORT ERROR_CODE_REMOTE_ERROR = 1001;
constexpr int32_t EXPORT ERROR_CODE_BEHIND_LIVE_WINDOW = 1002;
constexpr int32_t EXPORT ERROR_CODE_TIMEOUT = 1003;
constexpr int32_t EXPORT ERROR_CODE_FAILED_RUNTIME_CHECK = 1004;

constexpr int32_t EXPORT ERROR_CODE_PLAYER_ERROR = 1100;
constexpr int32_t EXPORT ERROR_CODE_SEEK_MODE_UNSUPPORTED = 1101;
constexpr int32_t EXPORT ERROR_CODE_ILLEGAL_SEEK_TARGET = 1102;
constexpr int32_t EXPORT ERROR_CODE_PLAY_MODE_UNSUPPORTED = 1103;
constexpr int32_t EXPORT ERROR_CODE_PLAY_SPEED_UNSUPPORTED = 1104;
constexpr int32_t EXPORT ERROR_CODE_DEVICE_MISSED = 1105;
constexpr int32_t EXPORT ERROR_CODE_INVALID_PARAM = 1106;
constexpr int32_t EXPORT ERROR_CODE_NO_MEMORY = 1107;
constexpr int32_t EXPORT ERROR_OPERATION_NOT_ALLOWED = 1108;

// Input/Output errors
constexpr int32_t EXPORT ERROR_CODE_IO_UNSPECIFIED = 2000;
constexpr int32_t EXPORT ERROR_CODE_IO_NETWORK_CONNECTION_FAILED = 2001;
constexpr int32_t EXPORT ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT = 2002;
constexpr int32_t EXPORT ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE = 2003;
constexpr int32_t EXPORT ERROR_CODE_IO_BAD_HTTP_STATUS = 2004;
constexpr int32_t EXPORT ERROR_CODE_IO_FILE_NOT_FOUND = 2005;
constexpr int32_t EXPORT ERROR_CODE_IO_NO_PERMISSION = 2006;
constexpr int32_t EXPORT ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED = 2007;
constexpr int32_t EXPORT ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE = 2008;

constexpr int32_t EXPORT ERROR_CODE_IO_NO_CONTENTS = 2100;
constexpr int32_t EXPORT ERROR_CODE_IO_READ_ERROR = 2101;
constexpr int32_t EXPORT ERROR_CODE_IO_CONTENT_BUSY = 2102;
constexpr int32_t EXPORT ERROR_CODE_IO_CONTENT_EXPIRED = 2103;
constexpr int32_t EXPORT ERROR_CODE_IO_CONTENT_NON_ALLOWED_USE = 2104;
constexpr int32_t EXPORT ERROR_CODE_IO_CONTENT_CANNOT_VERIFIED = 2105;
constexpr int32_t EXPORT ERROR_CODE_IO_CONTENT_EXHAUSTED_ALLOWED_USES = 2106;
constexpr int32_t EXPORT ERROR_CODE_IO_NETWORK_PACKET_SENDING_FAILURE = 2107;

// Content parsing errors
constexpr int32_t EXPORT ERROR_CODE_PARSING_UNSPECIFIED = 3000;
constexpr int32_t EXPORT ERROR_CODE_PARSING_CONTAINER_MALFORMED = 3001;
constexpr int32_t EXPORT ERROR_CODE_PARSING_MANIFEST_MALFORMED = 3002;
constexpr int32_t EXPORT ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED = 3003;
constexpr int32_t EXPORT ERROR_CODE_PARSING_MANIFEST_UNSUPPORTED = 3004;

// Decoding errors
constexpr int32_t EXPORT ERROR_CODE_DECODE_UNSPECIFIED = 4000;
constexpr int32_t EXPORT ERROR_CODE_DECODER_INIT_FAILED = 4001;
constexpr int32_t EXPORT ERROR_CODE_DECODER_QUERY_FAILED = 4002;
constexpr int32_t EXPORT ERROR_CODE_DECODING_FAILED = 4003;
constexpr int32_t EXPORT ERROR_CODE_DECODING_FORMAT_EXCEEDS_CAPABILITIES = 4004;
constexpr int32_t EXPORT ERROR_CODE_DECODING_FORMAT_UNSUPPORTED = 4005;

// AudioTrack errors
constexpr int32_t EXPORT ERROR_CODE_AUDIO_TRACK_UNSPECIFIED = 5000;
constexpr int32_t EXPORT ERROR_CODE_AUDIO_TRACK_INIT_FAILED = 5001;
constexpr int32_t EXPORT ERROR_CODE_AUDIO_TRACK_WRITE_FAILED = 5002;

// DRM errors
constexpr int32_t EXPORT ERROR_CODE_DRM_UNSPECIFIED = 6000;
constexpr int32_t EXPORT ERROR_CODE_DRM_SCHEME_UNSUPPORTED = 6001;
constexpr int32_t EXPORT ERROR_CODE_DRM_PROVISIONING_FAILED = 6002;
constexpr int32_t EXPORT ERROR_CODE_DRM_CONTENT_ERROR = 6003;
constexpr int32_t EXPORT ERROR_CODE_DRM_LICENSE_ACQUISITION_FAILED = 6004;
constexpr int32_t EXPORT ERROR_CODE_DRM_DISALLOWED_OPERATION = 6005;
constexpr int32_t EXPORT ERROR_CODE_DRM_SYSTEM_ERROR = 6006;
constexpr int32_t EXPORT ERROR_CODE_DRM_DEVICE_REVOKED = 6007;
constexpr int32_t EXPORT ERROR_CODE_DRM_LICENSE_EXPIRED = 6008;

constexpr int32_t EXPORT ERROR_CODE_DRM_PROVIDE_KEY_RESPONSE_ERROR = 6100;
} // namespace CastEngine
} // namespace OHOS

#endif // CAST_ENGINE_ERRORS_H